package com.h6.crm.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import org.springframework.format.annotation.DateTimeFormat;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Schema(description = "合同实体")
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("SO_Contract")
public class Contract extends BaseEntity implements Serializable {

    @Schema(description = "项目ID")
    @TableField("ProjectId")
    Long projectId;

    @Schema(description = "客户ID")
    @TableField("ClientId")
    Long clientId;

    @Schema(description = "公司商标ID")
    @TableField("EntityId")
    Long entityId; // 公司商标

    @Schema(description = "合同名，默认为项目名，用以区分同一项目可能有多阶段合同")
    @TableField("Name")
    String name; // 合同名，默认为项目名，用以区分同一项目可能有多阶段合同

    @Schema(description = "合同总金额")
    @TableField("Amount")
    BigDecimal amount; // 合同总金额

    @Schema(description = "签订日期")
    @TableField("SigningDate")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "Asia/Shanghai")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    Date signingDate; // 签订日期

    @Schema(description = "合同编号")
    @TableField("ContractCode")
    String contractCode; // 合同编号

    @Schema(description = "客户合同编号")
    @TableField("ClientContractCode")
    String clientContractCode; // 客户合同编号

    @Schema(description = "业务员ID")
    @TableField("SalesmanId")
    Long salesmanId; // 业务员

    @Schema(description = "付款方式")
    @TableField("PaymentMethod")
    String paymentMethod;

    @Schema(description = "付款状态：未付款，质保金，预付款，全款，尾款")
    @TableField("PaymentStatus")
    String paymentStatus;

    @Schema(description = "合同状态：履行中，终止，履行完成")
    @TableField("ContractStatus")
    String contractStatus;

    @Schema(description = "备注")
    @TableField("Remark")
    String remark;

    @Schema(description = "项目名")
    @TableField(exist = false)
    String projectName;

    @Schema(description = "公司商标")
    @TableField(exist = false)
    String entity; // 公司商标

    @Schema(description = "客户")
    @TableField(exist = false)
    String clientName;

    @Schema(description = "业务员")
    @TableField(exist = false)
    String salesman;

    @Schema(description = "附件路径")
    @TableField(exist = false)
    String attachmentUrl;

    @Schema(description = "附件ID")
    @TableField(exist = false)
    Long attachmentId;

    @Schema(description = "附件名")
    @TableField(exist = false)
    String attachmentName;

}
